<?php

namespace App\Models\Admin;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    use HasFactory;
    protected  $table ='wt_form';
    public $timestamps = false;

    public function categoryList($arrs ,$level=0,$pid=0)
    {
    	static $categorys = [];

    	foreach ($arrs as $arr ) {

    		if ($arr['pid'] == $pid) {
    			
    			$arr['level'] = $level;
    			$categorys[] = $arr;

    			$this->categoryList($arrs ,$level+1,$arr['id']);

    		}
    		
    	}
    	return $categorys;


    }
}
